package d1113.r212.num27;

public abstract class Animal {
    private String name;
    public Animal(){
    }

    public Animal(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public abstract void shout();
    public void eat(Food food){
        System.out.println(this.name+"在吃"+food.getName());
    }


}

class Cat extends Animal{
    public Cat() {
    }

    public Cat(String name) {
        super(name);
    }

    @Override
    public void shout() {
        System.out.println("喵喵喵叫");

    }

        }

class Dog extends Animal{
    public Dog() {
    }

    public Dog(String name) {
        super(name);
    }

    @Override
    public void shout() {
        System.out.println("汪汪汪");
    }
}
